<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * confirm.php
 * @author ranuandra
 *
 * 7 Mei 2012 09:07:46
 *
 * 
 */
?>
         <div class="toolbar-wrapper">
            	<div class="toolbar-container">

                </div>
            	<h1 class="title"><?php echo $lowongan->mstlowongan->deskripsi?></h1>
            </div>
            <?php 
            echo Form::open(URL::base().'admin/proseslowongan/save');
            echo Form::hidden('proseslowongan_id', $id, array()); 
            echo Form::hidden('mstlowongan_id', $lowongan->mstlowongan->id, array()); 
            foreach($datas as $data)
            {
            	echo Form::hidden('pelamarlowongan_id[]', $data->id, array());
            }  
			if(count($hadirs) > 0)
			{
	            foreach($hadirs as $hadir)
	            {
	            	echo Form::hidden('flag_hadir[]', $hadir, array());
	            }
			}
            foreach($loloses as $lolos)
            {
            	echo Form::hidden('flaglolos[]', $lolos, array());
            }
            foreach($panggils as $panggil)
            {
            	echo Form::hidden('panggils[]', $panggil, array());
            }
/*            foreach($proseses as $proses)
            {
            	echo Form::hidden('proses_id[]', $proses->id, array());
            } */     
            ?>
                <div class="form-container">
	                  <fieldset>
	                      <legend>Data Tahapan Proses</legend>
	                      <div><label for="uname">Proses Lamaran<em>*</em></label> 
	                          	<?php echo Form::select('mstproses_id', $proseslist, '', array())?>
                          </div>
                          <div><label for="uname">Alamat Proses<em>*</em></label> 
                          		<?php echo Form::input('alamat', '', array())?>
                          </div>	  
                          <div><label for="uname">Cabang / Department<em>*</em></label> 
                          		<?php echo Form::select('department', $cabangs, '', array('id' => 'departmentlist'))?>
                          </div>
                          <div><label for="uname">Pic<em>*</em></label> 
                          		<div id="userlist">
                          		<?php echo Form::select('user_id', $users, '', array())?>
                          		</div>
                          </div>	
                          <div><label for="uname">Tanggal<em>*</em></label> 
                          
                          		<?php echo Form::input('tgl', '', array('id' => 'prosesdate'))?>
                          </div>	     
                  	       <div><label for="uname">Jam<em>*</em></label> 
                          		<?php echo Form::input('jam', '', array('id' => 'jam'))?>
                          </div>	                                            
                  </fieldset>
                  
                 </div>
            <div class="content">
           		<table class="data">
                	<thead>
                    	<tr>
                        	
                        	<th>Kode</th>
                        	<th>Nama</th>
                        	<th>Tgl Lahir</th>
                        	<th>Jenis Kelamin</th>
                        	<th>Pendidikan</th>
                        	<th>Jurusan</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php 
                    if(isset($datas))
                    {
                    	foreach($datas as $data)
                    	{
                    		
                    ?>
                    	<tr>
                        	
                            <td><a href="<? echo URL::base() ?>admin/pelamar/detail/<?php echo $data->id?>" id="fancy"><?php echo $data->kode_lamaran?></a></td>
                            <td><?php echo $data->mstpelamar->nama_lengkap?></td>
                            <td><?php echo date("d-m-Y", strtotime($data->mstpelamar->tgl_lahir))?></td>
                            <td><?php echo $data->mstpelamar->jenis_kelamin?></td>
                            <td></td>
                            <td><?php echo $data->mstpelamar->mstjurusan->jurusan?></td>
                        </tr>
                    <?php 
                    	}
                    }
                    ?>
                    </tbody>
                    <tfoot>
                    	<tr>
                        	<td></td>
                            <td></td>
                        	<td></td>
                        	<td></td>
                            <td></td>
                        	<td>
                        	<?php 
                        		echo Form::submit('submit', 'Proses', array());
                        	?>
                        	</td>
                        </tr>                    
                    </tfoot>
                </table>
            </div>
            <?php 
	            
	            echo Form::close();
	            $tgl = strtotime(date("Y-m-d", strtotime($lowongan->tanggal)). " +1 day");
	            //echo $tgl;

            ?>
<script type="text/javascript">
	$(document).ready(function() {
		$('#prosesdate').datepicker({
			dateFormat: "yy-mm-dd",
			minDate: "<?php echo date("Y-m-d", $tgl) ?>"

		});
		$('#departmentlist').live('change', function(){
			$('#userlist').empty();
			//$(horloader).appendTo('.selopt_type');
			$('#userlist').load("<?php echo URL::base()?>admin/user/bydepartment/"+$(this).val(), function(response, status, xhr){
				if(status=="success")
				{
					//$('.horloader').remove();
					//$('select.seltype').multiselect();
				}
			});

		});
		
	})
</script> 